new Vue({
	el: '#app',
	data: {
		sdate: '',
		edate: '',
		sname: '',
		scardid: '',
		smeal: '',
		list: [],
		info: {
			fname: '',
			fcardId: '',
			qrcode: '',
			orderSn: '',
			list: [],
		},
		headers:[
				{title:'姓名',key:'realName'},
				{title:'身份证号',key:'cardId'},
				{title:'开单时间',key:'createTime'},
				{title:'体检套餐',key:'orderName'},
				{title:'订单状态',key:'status'},
				],
		open: false,
		totalNum:'',
		openNum:1,
	},
	created() {

		showHead();
		showLeftMenu();
		// 在页面创建时发送Ajax请求
		var params = new URLSearchParams(window.location.search);
		
		this.scardid = params.get('card_id'); 
		
		this.getMealList(0)
		
		
	},
	methods: {
		getMealList: function(page) {

			var _this = this;
			this.page = page
			$.ajax("Order/getOrderList", {
				type: "POST",
				data: {
					sname: _this.sname,
					scardid:_this.scardid,
					mealId: _this.smeal,
					sex: _this.sex,
					page:page,
				},
				success: function(data, textStatus) {
					let datas = JSON.parse(data);
					if (datas.statusCode == 200) {
						
							_this.list = datas.datas.order
							_this.totalNum = datas.datas.count
					} else {
						console.log(datas.errMsg)
					}
				}
			})
		},
		getOrderInfo: function(id) {

			var _this = this;
			$.ajax("Order/getOrderInfo", {
				type: "POST",
				data: {
					id: id
				},
				success: function(data, textStatus) {
					let datas = JSON.parse(data);
					if (datas.statusCode == 200) {
						_this.info.fname = datas.datas.order.realName;
						_this.info.fcardId = datas.datas.order.cardId;
						_this.info.orderSn = datas.datas.order.orderSn;
						_this.info.qrcode = datas.datas.order.qrcode;
						_this.info.list = datas.datas.order.projects;
					} else {
						console.log(datas.errMsg)
					}
				}
			})

		},

		showFrom: function(id) {
			this.getOrderInfo(id)
			this.open = true;
			console.log(this.open);
			console.log(this.info)
		},
		closeFrom: function() {
			this.open = false;
		},
		updateList(openNum){	
			this.openNum = openNum
			this.getMealList(openNum)	
		},
		updateOpen(open){
				this.open = open
		},
		sousuo(){
			console.log(1);
			this.getMealList(0)
		}
		
	},
	computed: {

	},

})